package com.project.datacenter.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.project.datacenter.dto.UserXlDto;
import com.project.datacenter.entity.BusLine;
import com.project.datacenter.entity.UserXl;
import com.project.datacenter.mapper.UserXlMapper;
import com.project.datacenter.service.UserXlService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserXlServiceImpl implements UserXlService {

    @Resource
    private UserXlMapper userXlMapper;

    @Override
    @DS("master")
    public List<UserXlDto> getUserYhxxList(BusLine busLine) {
        return userXlMapper.selectYhxxList(busLine);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    @DS("master")
    public void save(UserXl entity) {
        userXlMapper.insert(entity);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    @DS("master")
    public void delete(Integer jgxlid) {
        UserXl entity = new UserXl();
        entity.setJgxlid(jgxlid);
        userXlMapper.deleteXl(entity);
    }
}
